Template a registry's dl field
authorSteven Fackler <sfackler@palantir.com>
Mon, 18 Dec 2017 23:22:04 +0000 (15:22 -0800)
committerSteven Fackler <sfackler@palantir.com>
Mon, 18 Dec 2017 23:22:04 +0000 (15:22 -0800)
commitaba673dbd9b683053a58afea9b48c14c11444c75
treeb9d1a8896d1fdac283f7ef48b89ef7f96df9698a
parent4bbfc70da98bc00edb5c0e04d32326b270753f2e
Template a registry's dl field

Previously, crate files were always downloaded from
`/{crate}/{version}/download`. However, if the backing crate store for a
custom registry is a raw file server rather than an API endpoint that
requires every file to be named `download` which is a bit weird. Now a
registry's dl URL can be templated with `{crate}` and `{version}` to
have more control over the resulting path.

For backwards compatibility, we append the default template suffix onto
the dl URL if neither of the template parameters are present for
backwards compatibility.
src/cargo/sources/registry/mod.rs
src/cargo/sources/registry/remote.rs
tests/alt-registry.rs
tests/cargotest/support/registry.rs